UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'q0fya3jYBC+rNr/ggqcSA/u0Nc9Yu21EafJrSiSxxWE='
WHERE
key_id = 'ddbe187a97dd11ef7fbb4b1df7d010275d32d094adbc96a1a069b0f1dd3be81a'
AND (
token = 'q0fya3jYBC+rNr/ggqcSA/u0Nc9Yu21EafJrSiSxxWE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)