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