UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nwPAtkgsAM1+iFnabjuOcB82USjb2hLkU7Lwmg7RM1U='
WHERE
key_id = '3151b4308940b06167c25252dddaaf9a6dfdc1d64bda0820cfb0b8ae90c095b2'
AND (
token = 'nwPAtkgsAM1+iFnabjuOcB82USjb2hLkU7Lwmg7RM1U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)