UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6sbb3tGSeCs3dEehJ8TjlIiw8iQegBz9KhfzEiRCLZ8=' 
WHERE 
  key_id = '203504684dc3760d0fee050179983caa3dc72af7f9ac1e58428cbe8c91a58073' 
  AND (
    token = '6sbb3tGSeCs3dEehJ8TjlIiw8iQegBz9KhfzEiRCLZ8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051