UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8Y3jrHzv9u59aB2+rbkoZyWZOlrFpmCIWlm47wmEUWU='
WHERE
key_id = '558db96c37317eb46f1204c15b670185cfa9df47638b3b71e9d1f07e6a5cd77d'
AND (
token = '8Y3jrHzv9u59aB2+rbkoZyWZOlrFpmCIWlm47wmEUWU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)