UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wtZUsuUdmNb08XgxYhas2iCJUcEqcV1T1E/qfTesc6o=' 
WHERE 
  key_id = '9066e8fb627ea44cb297d15198f7cc34ab77b90384966144eca66f7ebd18a795' 
  AND (
    token = 'wtZUsuUdmNb08XgxYhas2iCJUcEqcV1T1E/qfTesc6o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032