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