UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GWn638nHtjDCFGhSeEUmO+mg6hNG9NbWL1jidQurm8I='
WHERE
key_id = '21c5138fe904f543759712ea1deb7502b904b00b4570cfee4fd91c7b0783bc46'
AND (
token = 'GWn638nHtjDCFGhSeEUmO+mg6hNG9NbWL1jidQurm8I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)