UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OCa6mu9pyBxhF5PzS1tL53zaG6K0WW+9WdClCPfupA4=' 
WHERE 
  key_id = '52908872576db7edd2631fddab1313b14f0e467398ce5bd918af79cf432d3804' 
  AND (
    token = 'OCa6mu9pyBxhF5PzS1tL53zaG6K0WW+9WdClCPfupA4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044