UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '00N8MaeB0b84bMxeURFoKZHoXEGyl3gpmOawSgSSUSQ='
WHERE
key_id = 'd7a969445032fb90fee661183a9959681adf1a0ffa6190cde6f3c7106b8ea6fe'
AND (
token = '00N8MaeB0b84bMxeURFoKZHoXEGyl3gpmOawSgSSUSQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)