UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KuY5yEghSMqSPFNKsiqQJbe8hOYEYZ4eHc9VxXn7N2o='
WHERE
key_id = 'e87813e459bbb73d4db3ae0bcbcceadb50220dbd160500103284d98cbc8006e4'
AND (
token = 'KuY5yEghSMqSPFNKsiqQJbe8hOYEYZ4eHc9VxXn7N2o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)