UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YglKGknllgEWU3Qo+053BLW7ZN0eh2MVGy6KM9vLwyA='
WHERE
key_id = 'e3b4772d8b177795ae61b875f3eafeb03c44859ef0726ae609806b2d54093e7d'
AND (
token = 'YglKGknllgEWU3Qo+053BLW7ZN0eh2MVGy6KM9vLwyA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)