UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7qlvlKoviQkaZtloZ0vz8FAGTEQ0KXbCrcRY03DMyKg='
WHERE
key_id = '7b7bf291415043ed635002365368051bc496142108afe1c12966d26be67d4842'
AND (
token = '7qlvlKoviQkaZtloZ0vz8FAGTEQ0KXbCrcRY03DMyKg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)