UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'M16MLj29ZA8CEan28CHMwdWDl5kQaBAu6ueeN3DJwhI='
WHERE
key_id = '29344d9a18737fbb15c3f1ce905be44e35c5e76970f435a6408dc4257314a1b4'
AND (
token = 'M16MLj29ZA8CEan28CHMwdWDl5kQaBAu6ueeN3DJwhI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)