UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hBkmSQDOKf2qDfGAY+9y+eahBPsgF9ieVjG1mW9Lhp0='
WHERE
key_id = 'e78a31e89e23a7313b81039eb7b66be9fbca257cb5e06c843e66d75b90de9ca4'
AND (
token = 'hBkmSQDOKf2qDfGAY+9y+eahBPsgF9ieVjG1mW9Lhp0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)