UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6GTbJkaKqfqpi5XFqlVzINj8SjldDAMe1cDyORZoc+c='
WHERE
key_id = 'c81cb20d682c3e5dd06141dc06c779c7184c2ca1e00b7b286e739cc6ef991e36'
AND (
token = '6GTbJkaKqfqpi5XFqlVzINj8SjldDAMe1cDyORZoc+c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)