UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3m2kAwFlkI3xqUZwuk/wUYafIKHubw6dQWnz9CsDlgk='
WHERE
key_id = 'aaa3b13e498b1252f1bcffc70345241bd513cf378389b800a31dadc90a6631c1'
AND (
token = '3m2kAwFlkI3xqUZwuk/wUYafIKHubw6dQWnz9CsDlgk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)