UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AoUKJPRlUDnPeY+e45f0F60Za1AgN9YERtjRwWxz0yM='
WHERE
key_id = 'e7eb9d0419f50ef8f184ec20bb250157400e62a206a80e40ececbbb05452ee59'
AND (
token = 'AoUKJPRlUDnPeY+e45f0F60Za1AgN9YERtjRwWxz0yM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)