UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xTv2i5amcGyVmXhW84aiac71vh/NHHNkm+NrDkXjzAk='
WHERE
key_id = 'fd3116c6f474457e23f53af7f9b93e121e5b606ba5c13e63251c0ed6df87e252'
AND (
token = 'xTv2i5amcGyVmXhW84aiac71vh/NHHNkm+NrDkXjzAk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)