UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YApifVJwSSP2AcjYsNpaa7ZE9zkFWMnR+eYaBuGLw9c='
WHERE
key_id = '683129275ae122ff07679e1c9d500e1681f5d00206968b5d86722efe03110fe0'
AND (
token = 'YApifVJwSSP2AcjYsNpaa7ZE9zkFWMnR+eYaBuGLw9c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)