UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+8MxUAkEeiHhmDCysOjvwMBHvn80T7pTOfJD3j+jxZk='
WHERE
key_id = 'a5ff2bffcf8bdb319e8f276c5880399a8431c50c348737ccc0d3e4e85a9c2d53'
AND (
token = '+8MxUAkEeiHhmDCysOjvwMBHvn80T7pTOfJD3j+jxZk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)