UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vwfzwU20Y99cwVJQZ6uCW04u2LPsoya6qOA1J4N/gL0='
WHERE
key_id = 'ad674007154d4c1875d6aa5a5f21e340a09cdf1ae017ab342f681525a1676665'
AND (
token = 'vwfzwU20Y99cwVJQZ6uCW04u2LPsoya6qOA1J4N/gL0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)