UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MqxQfsD+NT69Ke0q8XsnBWreK0c4w30Rdxfsjh3/vZ4=' 
WHERE 
  key_id = '5d456b10750667390dab0440f81869168ff4e320124a2f57afc546eab05a2ee8' 
  AND (
    token = 'MqxQfsD+NT69Ke0q8XsnBWreK0c4w30Rdxfsjh3/vZ4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043