UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mAA+eqFmtlfzzpUGyg3vl4JIhuqI1AuBAHDddyokGEw='
WHERE
key_id = 'ecb85a8e7f76120f5d36e8ff32fbcea57973471163a1d215e1fd1dddcca08b49'
AND (
token = 'mAA+eqFmtlfzzpUGyg3vl4JIhuqI1AuBAHDddyokGEw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)