UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hN1dvEhtuyr8jbnio5jiuqjK6yMYowot4urxKzWL+JA=' 
WHERE 
  key_id = '4d4f87b659de2132750197fa9fb4487f60b1588ce5904e50f67c0997059ac2d3' 
  AND (
    token = 'hN1dvEhtuyr8jbnio5jiuqjK6yMYowot4urxKzWL+JA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017