UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iA/CU65jaEcOmwTZx1myeNr6nor4j55meshXB6EEr+s=' 
WHERE 
  key_id = 'c1869d8081f22188ced1b3479fa3bec1407a20d3f622f07fda192226313c1301' 
  AND (
    token = 'iA/CU65jaEcOmwTZx1myeNr6nor4j55meshXB6EEr+s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039