UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aSc2IFI8wx1EySIOwCKMnEviTNzPznsdRseEBRgbKk0='
WHERE
key_id = 'd41f87640983b472f2469b3f97f4079f2932b6377af1b0bfa16894bdcfec1b06'
AND (
token = 'aSc2IFI8wx1EySIOwCKMnEviTNzPznsdRseEBRgbKk0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)