UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Cs+KV20eBidfuuo9goLNotYIRt5E4g6PL90T1tOwyt8='
WHERE
key_id = '9d8812941484ac4db099528203dcee54f4ac24cafe667d2e23917e4ec25cfd36'
AND (
token = 'Cs+KV20eBidfuuo9goLNotYIRt5E4g6PL90T1tOwyt8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)