UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xZ5kmY8ZSFFH1wIZ9MCzpkAt62mhl9dVRPXNM94VUpo='
WHERE
key_id = '18e86d243d1da053cc5a32eb93b2264171573f465f5949622ccc18d53c96d52a'
AND (
token = 'xZ5kmY8ZSFFH1wIZ9MCzpkAt62mhl9dVRPXNM94VUpo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)