UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WyUzhDFYYYiAoxp6D5DvQE2BtxbWZkIG4wG3MlXF8dY='
WHERE
key_id = '5dd6def4fc3907e3836a2f0e453a38da6bb75fafebdcc2e90eb748a04dd8dcef'
AND (
token = 'WyUzhDFYYYiAoxp6D5DvQE2BtxbWZkIG4wG3MlXF8dY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)