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